package com.charon.auth.common.entity;

import com.charon.auth.common.abstraction.AbstractSMSCodeProperties;

import java.time.LocalDateTime;

/**
 * @ClassName: SMSCode
 * @Description: 短信验证码
 * @Author Charon [248135724@qq.com]
 * @Date 2019/2/7 3:29
 * @Version V 1.0
 */
public class SMSCode {

    private String code;

    private LocalDateTime expireTime;

    public SMSCode(String code,LocalDateTime expireTime){
        this.code=code;
        this.expireTime=expireTime;
    }

    public SMSCode(String code,int expireSeconds){
        this.code=code;
        this.expireTime=LocalDateTime.now().plusSeconds(expireSeconds);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public LocalDateTime getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(LocalDateTime expireTime) {
        this.expireTime = expireTime;
    }

    public boolean isExpried(){
        return LocalDateTime.now().isAfter(expireTime);
    }

}
